<template>
  <div :class="wrapClass">
    <!--搜索定位-->
    <div :class="searchClass" v-if="canSearch">
      <!--自动完成组件-->
      <autoComplete
        ref="searchAutoComplete"
        :simple="false"
        :placeholder="placeholder"
        :data="completeOriginData"
        :clearable="true"
        :delay="delay"
        remote
        :remoteUrl="remoteUrl"
        :remoteMethod="remoteMethod || defaultRemoteMethod"
        :remoteExtendsParams="requestDataExtendsParams"
        :limit="searchShowLimit"
        :pinyinSearch="pinyinSearch"
        :doValidate="false"
        :emptyFilter="false"
        @choose="changeQuery" />
      <!--       <atyInput v-model="currentFilter"
                          :clearable="clearable"
                          :icon="icon"
                          @click="clickSearch"
                          @focus="focus"
                          @blur="blur"
                          @keydown="keydown"></atyInput>-->
    </div>
    <!--操作按钮-->
    <div :class="operateClass" v-if="hasOperate">
      <atyButton class="aty-tree-btn-icon" icon="arrow-up-a" text="" @click="clickMoveUp" />
      <atyButton class="aty-tree-btn-icon" icon="arrow-down-a" text="" @click="clickMoveDown" />
      <atyButton class="aty-tree-btn-icon" icon="trash-a" text="" @click="clickDelete" />
      <slot></slot>
    </div>
    <!--树-->
    <ul :class="treeClass" id="jsTreeContain" ref="treeContain">
      <aty-tree-node
        ref="treeNode"
        v-for="(item,index) in currentData"
        :key="item.id"
        :index="''+index"
        :showIcon="showIcon"
        :showCheckbox="showCheckbox"
        :canMendName="canMendName"
        :lazyLoad="lazyLoad"
        :draggable="draggable"
        :connectParent="connectParent"
        :cascade="cascade"
        :tree-node-data="item" />
    </ul>
    <!--正在加载-->
    <div :class="loadingWrapClass" v-if="showLoading">
      <div class="">
        <i :class="loadingClass"></i>
        <span>Loading</span>
      </div>
    </div>
    <!--空数据-->
    <div :class="[prefixCls + '-empty']" v-if="showEmpty">{{ localeEmptyText }}</div>

    <!--如果可以拖动-->
    <div :class="treeDragPreviewClass" ref="jsTreeDragPreview" v-if="draggable"></div>
    <div :class="treeDragLineClass" ref="jsTreeDragLine" v-if="draggable" :style="treeDragLineStyle"></div>
    <div :class="treeDragContentClass" ref="jsTreeDragContent" v-if="draggable" :style="treeDragContentStyle"></div>
  </div>
</template>
<script type="text/ecmascript-6" src="./index.js"></script>
